/**
 * Project Name: mms-provider-user
 * File Name: EmployeeMapper
 * Package Name: com.scb.dev.mms.dao
 * Date: 2018/11/27 2:16 PM
 * Copyright (c) 2018, Wang, Haoyue All Rights Reserved.
 */
package com.scb.dev.mms.dao;

import com.scb.dev.mms.pojo.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * ClassName: EmployeeMapper
 * Description: Employee Mapper Interface
 * Date: 2018/11/27 2:16 PM
 *
 * @author Wang, Haoyue
 * @version V1.0
 * @since JDK 1.8
 */
@Mapper
public interface EmployeeMapper {

    /**
     * insertSelective: add employee
     *
     * @param employee
     * @return  1,success; 0,failed
     */
    int insertSelective(Employee employee);

    /**
     * deleteByPrimaryKey: delete employee by id
     *
     * @param employeeId
     * @return  1,success; 0,failed
     */
    int deleteByPrimaryKey(String employeeId);

    /**
     * deleteByEmployeePositionId: delete employee by position id
     *
     * @param employeePositionId
     * @return  1,success; 0,failed
     */
    int deleteByPositionId(String employeePositionId);

    /**
     * updateByPrimaryKeySelective: update employee
     *
     * @param employee
     * @return  1,success; 0,failed
     */
    int updateByPrimaryKeySelective(Employee employee);

    /**
     * selectByPrimaryKey: query employee by id
     *
     * @param employeeId
     * @return
     */
    Employee selectByPrimaryKey(String employeeId);

    /**
     * selectEmployeeNameByPrimaryKey: query name by id
     *
     * @param employeeId
     * @return  not null: success
     */
    String selectEmployeeNameByPrimaryKey(String employeeId);

    /**
     * selectEmployeeNameByPrimaryKey: query nickname by id
     *
     * @param employeeId
     * @return not null: success
     */
    String selectEmployeeNicknameByPrimaryKey(String employeeId);

    /**
     * findAllEmployee: get all employees
     *
     * @return
     */
    List<Employee> findAllEmployee();

    /**
     * checkIsHaveEmployeeByEmployeePositionId: is has employee by position id
     *
     * @param employeePositionId
     * @return  not 0: has
     */
    int checkIsHaveEmployeeByEmployeePositionId(String employeePositionId);


    /**
     * @Description: select num of record with the given roleId
     * @author: YouYu 游宇
     * @methodName: selectByRoleId
     * @param: String roleId
     * @returnType: int
     * @createTime: 12/8/2018 12:02 PM
     **/
    int selectByRoleId(String roleId);


    /**
     * @Description: update records by roleId
     * @author: YouYu 游宇
     * @methodName: updateByRoleId
     * @param: String roleId
     * @returnType: boolean
     * @createTime: 12/8/2018 11:30 AM
     **/
    boolean updateByRoleId(@Param("newRoleId")String newRoleId, @Param("oldRoleId")String oldRoleId);

}
